<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/10/18 13:53
 * Desc:
 */
class Request_Api_V2_Customize extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }


    public function plan()
    {
        $this->rules = [
            ['page', ['not_empty', 'digit', $this->rule_min(1)]],
            ['pagesize', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function plan_more()
    {
        $this->rules = [
            ['page', ['not_empty', 'digit', $this->rule_min(0)]],
            ['pagesize', ['not_empty', 'digit', $this->rule_min(10)]],
        ];
        return $this;
    }

    public function plan_where()
    {
        $this->rules = [];
        return $this;
    }
    public function plan_show()
    {
        $this->rules = [
            ['id', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function add_order()
    {
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        $this->rules = [
            ['phone', ['not_empty', 'phone']],
            ['dest', ['not_empty']],
            ['startplace', ['not_empty']],
            ['sex', ['not_empty', $this->rule_in_array(['先生', '女士'])]],
            ['days', ['digit']],
            ['adultnum', ['digit']],
            ['childnum', ['digit']],
            ['contactname', ['not_empty']],
            ['starttime', ['not_empty']],
            ['captcha_key', ['not_empty']],
            ['code', ['not_empty']],
        ];

        return $this;
    }

    public function show()
    {
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        $this->rules = [
            ['product_id', ['not_empty', 'digit', $this->rule_min(1)]]
        ];

        return $this;
    }

    public function improve_order_info()
    {
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        $this->rules = [
            ['order_id', ['not_empty', 'digit', $this->rule_min(1)]]
        ];


        return $this;
    }
}